import { defineConfig } from 'vite';
import path from 'path'
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx'

function _resolve(dir: string) {
  return path.resolve(__dirname, dir)
}
export default defineConfig({
  plugins: [vue(), vueJsx()],
  build: {
    lib: {
      entry: 'src/index.ts',
      name: 'PPComponentLibrary',
      fileName: (format) => `pp-component-library.${format}.js`,
    },
    rollupOptions: {
      external: ['vue'],
      output: {
        globals: {
          vue: 'Vue',
        },
      },
    },
  },
  resolve: {
    alias: {
      '@': _resolve('src')
    }
  }
});